package com.feige.controller;


import com.feige.pojo.vo.ChatMsgVo;
import com.feige.result.AjaxResult;
import com.feige.service.GroupChatMsgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 群聊消息表 前端控制器
 * </p>
 *
 * @author feige
 * @since 2021-05-10
 */
@Api(tags = "群聊消息控制器")
@RestController
@RequestMapping("/chat/group-chat-msg")
public class GroupChatMsgController {

    @Autowired
    private GroupChatMsgService groupChatMsgService;

    @ApiOperation("获取群聊消息")
    @GetMapping("/get/{pageNum}")
    public AjaxResult queryGroupMsg(@PathVariable Integer pageNum, String groupId, Integer id){
        List<ChatMsgVo> chatMsgVos = groupChatMsgService.queryGroupMsg(pageNum, groupId,id);
        int total = groupChatMsgService.queryGroupMsgTotal(pageNum, groupId,id);
        AjaxResult success = AjaxResult.success(chatMsgVos);
        success.put("total",total);
        return success;
    }
}

